package com.company.psm.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


@Entity
@Table(name = "bills")
public class Bill implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5436999567655853446L;

	private long id;
	private Date billDate;
	private String storeName;
	private String billNumber;
	private String saleStaffName;
	private String customerName;
	//private List<Medicine> medicines;
	private String totalValue;
	private Store store;
	private String description;
	private User user;
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@ManyToOne
	public Store getStore() {
		return store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	@Column(name = "TOTALVALUE", length = 200)
	public String getTotalValue() {
//		return Util.dotPrice(totalValue);
		return totalValue;
	}
	public void setTotalValue(String totalValue) {
		this.totalValue = totalValue;
	}

	@Column(name = "STORENAME", length = 200)
	public String getStoreName() {
		return storeName;
	}

	public void setStoreName(String storeName) {
		this.storeName = storeName;
	}

	@Column(name = "BILLNUMBER", length = 200)
	public String getBillNumber() {
		return billNumber;
	}

	public void setBillNumber(String billNumber) {
		this.billNumber = billNumber;
	}

	@Column(name = "SALESTAFFNAME", length = 200)
	public String getSaleStaffName() {
		return saleStaffName;
	}

	public void setSaleStaffName(String saleStaffName) {
		this.saleStaffName = saleStaffName;
	}

	@Column(name = "CUSTOMERNAME", length = 200)
	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	@Column(name = "BILLDATE", length = 200)
	public Date getBillDate() {
		return billDate;
	}

	public void setBillDate(Date billDate) {
		this.billDate = billDate;
	}

	@Column(name = "DESCRIPTION", length = 200)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	@ManyToOne(fetch = FetchType.EAGER)
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
//	@ManyToMany(fetch = FetchType.EAGER, mappedBy = "bills",cascade = { CascadeType.REMOVE })
//	@Fetch(value = FetchMode.SUBSELECT)
//	public List<Medicine> getMedicine() {
//		return medicines;
//	}
//
//	public void setMedicine(List<Medicine> medicine) {
//		this.medicines = medicine;
//	}

}
